package com.bank.service.impl;

import com.bank.entity.UserInfo;
import com.bank.mapper.UserInfoMapper;
import com.bank.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 用户信息服务实现类
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;

    @Override
    public List<UserInfo> findAll() {
        return userInfoMapper.findAll();
    }

    @Override
    public UserInfo findById(Long customerID) {
        return userInfoMapper.findById(customerID);
    }

    @Override
    @Transactional
    public boolean add(UserInfo userInfo) {
        return userInfoMapper.insert(userInfo) > 0;
    }

    @Override
    @Transactional
    public boolean update(UserInfo userInfo) {
        return userInfoMapper.update(userInfo) > 0;
    }

    @Override
    @Transactional
    public boolean delete(Long customerID) {
        return userInfoMapper.deleteById(customerID) > 0;
    }
} 